//
// Created by lymk on 2021/8/12.
//

#ifndef GAME2D_ITEMACTOR_H
#define GAME2D_ITEMACTOR_H


#include <AnimeComponent.h>
#include "../Component/PhyComponent.h"
#include "../GMath.h"
#include "../Utils.h"

class ItemActor {
    PicData* picData;

    GMath::Vec2 renderPos;

    GMath::Vec2 collidePos;

    GMath::Vec2 collideSize;

    float fallSpeed;

private:
    //flag
    bool bFall;
    bool bShouldDestory;
    bool bDelayDestory;
    CoolUtil* delayCool;

    float score;
public:
    bool isBFall() const;

    void setBFall(bool bFall);

    float getFallSpeed() const;

    void setFallSpeed(float fallSpeed);

    PicData *getPicData() const;

    void setPicData(PicData *picData);

    const GMath::Vec2 &getRenderPos() const;

    void setRenderPos(const GMath::Vec2 &renderPos);

    const GMath::Vec2 &getCollidePos() const;

    void setCollidePos(const GMath::Vec2 &collidePos);

    const GMath::Vec2 &getCollideSize() const;

    void setCollideSize(const GMath::Vec2 &collideSize);

    bool isBShouldDestory() const;

    void setBShouldDestory(bool bShouldDestory);

public:
    ItemActor();

    void Initialize(std::string path,GMath::Vec2 initPos,float speed,float iscore);

    void Initialize(std::string path,GMath::Vec2 initPos,float speed,float iscore,bool delay,float delayTime);

    float getScore() const;

    void setScore(float score);

    void Update(double DeltaSeconds,RenderUtils renderUtils,PhyComponent* worldCollide);

    GMath::Rectangle getCollideBox();

    void HandleFall(double DeltaSeconds, PhyComponent *worldCollide);

    void HandleRender(RenderUtils renderUtils);

    void Finalize();
};


#endif //GAME2D_ITEMACTOR_H
